<template>
  <el-menu :default-active="active" class="el-menu-vertical-demo">
    <el-submenu index="1">
      <template slot="title">
        <i class="iconfont">&#xe696;</i>
        <span>商品管理</span>
      </template>
      <el-menu-item index="1-1" @click="storageIndex('1-1')">
        <router-link tag="div" to="/orProduct">
          <i class="iconfont">&#xe60b;</i>
          产品管理
        </router-link>
      </el-menu-item>
      <el-menu-item index="1-2" @click="storageIndex('1-2')">
        <router-link tag="div" to="/OrSpecifications">
          <i class="iconfont">&#xe65d;</i>
          规格管理
        </router-link>
      </el-menu-item>
      <el-menu-item index="1-3" @click="storageIndex('1-3')">
        <router-link tag="div" to="/OrClassification">
          <i class="iconfont">&#xe600;</i>
          分类管理
        </router-link>
      </el-menu-item>
      <el-menu-item index="1-4" @click="storageIndex('1-4')">
        <router-link tag="div" to="/OrBrand">
          <i class="iconfont">&#xe633;</i>
          品牌管理
        </router-link>
      </el-menu-item>
      <el-menu-item index="1-5" @click="storageIndex('1-5')">
        <router-link tag="div" to="/OrModel">
          <i class="iconfont">&#xe651;</i>
          型号管理
        </router-link>
      </el-menu-item>
    </el-submenu>
    <el-submenu index="2">
      <template slot="title">
        <i class="iconfont">&#xe629;</i>
        <span>订单管理</span>
      </template>
      <el-menu-item index="2-1" @click="storageIndex('2-1')">
        <router-link tag="div" to="/OrderList">
          <i class="iconfont">&#xe615;</i>
          订单列表
        </router-link>
      </el-menu-item>
    </el-submenu>
  </el-menu>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
  
  data() {
    return {
      // active: '1-1',
    }
  },

  computed: {
    ...mapState('leftMenu', {
      active: state => state.active
    }),
  },

  methods: {
    storageIndex(index) {
      this.$store.commit('leftMenu/active', index)
    }
  }
}
</script>

<style lang='scss' scoped>
@import "../scss/LeftMenu.scss";
</style>